class Mail:

    def __init__(self,driver):
        self.driver = driver

    def Login(self,username,password):
        """登录"""
        self.driver.find_element_by_id("switchAccountLogin").click()
        iframe = self.driver.find_elements_by_tag_name("iframe")[0]
        self.driver.switch_to.frame(iframe)
        self.driver.find_element_by_name("email").clear()
        self.driver.find_element_by_name("email").send_keys(username)
        self.driver.find_element_by_name("password").clear()
        self.driver.find_element_by_name("password").send_keys(password)
        self.driver.find_element_by_id("dologin").click()

    def Logout(self):
        """退出"""
        self.driver.find_element_by_link_text("退出").click()